package User;

import Operation.*;

import java.util.Scanner;

public class NormalUser extends User{
    public NormalUser(String name) {
        super(name);
        this.ioOperations = new IOOperation[]{
                new ExitOperation(),
                new FindOperation(),
                new BorrwoedOperation(),
                new ReturnOperation()
        };
    }

    @Override
    public int menu() {
        System.out.println("=============================");
        System.out.println("1、查找图书");
        System.out.println("2、借阅图书");
        System.out.println("3、归还图书");
        System.out.println("0、退出图书");
        System.out.println("=============================");

        w:{
            System.out.println("请选择你的操作:");
            Scanner scan = new Scanner(System.in);
            int choice = scan.nextInt();

            while (choice > 3 || choice < 0) {
                System.out.println("请重新输入!");
                break w;
            }
            return choice;
        }
        return menu();
    }
}
